<template>
  <div class="box">
    <div class="sunbox1">
      <div class="newstitle">
        <span class="title">热点新闻</span>
        <span class="title2">
          <router-link to="/news">
            <a class="more">MORE<i class="el-icon-plus"></i></a>
          </router-link>
        </span>
      </div>
      <div class="newlist">
        <div class="listitem" v-for="(item,index) in newsList" :key="index">
          <ul>
            <li @click="goDeatil(item.id)">
              <i class="el-icon-caret-right"></i>
              <a>&nbsp;{{item.title}}</a>
            </li>
            <li class="time"><i class="el-icon-date"></i>&nbsp;{{item.updateTime}}</li>
          </ul>
        </div>
      </div>
    </div>
    <div class="sunbox2">
      <div class="newstitle">
        <span class="title">信息公告</span>
        <span class="title2">
          <router-link to="/news">
            <a class="more">MORE<i class="el-icon-plus"></i></a>
          </router-link>
        </span>
      </div>
      <div class="newlist2">
        <div class="listitem" v-for="(item,index) in noticeList" :key="index">
          <ul>
            <li @click="goDeatil2(item.id)"><i class="el-icon-caret-right"></i><a>&nbsp;{{item.title}}</a></li>
            <li class="time"><i class="el-icon-date"></i>&nbsp;{{item.updateTime}}</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomeCall',
  data () {
    return {
      newsList: [],
      noticeList: []
    }
  },
  methods: {
    getNews () {
      this.$axios({
        method: 'get',
        url: '/news/newNews'
      }).then((res) => {
        this.newsList = res.data.data
      })
    },
    getNotice () {
      this.$axios({
        method: 'get',
        url: '/notice/new'
      }).then((res) => {
        this.noticeList = res.data.data
      })
    },
    goDeatil (id) {
      this.$router.push({
        path: '/Deatil',
        query: {
          name: 'News',
          id: id
        }
      })
    },
    goDeatil2 (id) {
      this.$router.push({
        path: '/Deatil',
        query: {
          name: 'Notice',
          id: id
        }
      })
    }
  },
  mounted () {
    this.getNews()
    this.getNotice()
  }
}
</script>

<style scoped>
.box {
  /* height: 500px; */
  /* border: black 1px solid; */
  overflow: hidden;
  /* margin-top: 50px; */
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}
.sunbox1 {
  /* float: left; */
  width: 600px;
  height: 500px;
  /* margin-left: 150px; */
}
.sunbox2 {
  /* float: left; */
  width: 600px;
  height: 500px;
  /* margin-left: 150px; */
}
.news {
  font-family: "微软雅黑";
  font-size: 35px;
  line-height: 22px;
  padding: 15px 15px 0 20px;
}
.newsContent {
  width: 100%;
  height: 100px;
}
.newstitle {
  height: 60px;
  font-size: 25px;
}
.title {
  color: #002854;
  font-size: 25px;
  margin: 13.5px 0;
  float: left;
  padding-left: 10px;
}
.title2 {
  color: #9f0211;
  margin: 13.5px 0;
  float: right;
  padding-right: 10px;
}
.newlist {
  background: #ffffff;
  margin: 0 10px 10px 10px;
  height: 420px;
  box-shadow: 10px 10px 10px #eeeeee;
}
.newlist2 {
  background: #ffffff;
  margin: 0 10px 10px 10px;
  height: 420px;
  box-shadow: 10px 10px 10px #eeeeee;
}
.listitem {
  padding: 15px 30px 10px 30px;
}
.time {
  font-size: 16px;
  color: #9a9a99;
  padding-left: 30px;
}
li {
  line-height: 30px;
  font-size: 20px;
  color: #002854;
  width: 500px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.more {
  color: #9f0211;
}
a {
  color: #002854;
  text-decoration: none;
}
ul {
  cursor: pointer;
}
</style>
